Ext.define('PJ.view.messagemanagement.RestoredMessageList', {
    extend: 'AM.default.DefaultList',
    alias: ['widget.restoredMessageList'],
    requires: ['AM.default.DefaultSearchForm', 
               'AM.default.DateTime', 
               'AM.default.DefaultDateField'
               ],
    selModel: {
        selType: '',
        checkOnly: true
    },
    newsUserLink:"",
    initComponent: function(){
    	var me = this;
        me.columns = [{
            header: '回复人',
            dataIndex: 'userName',
            width: 180,
			renderer: function(value, metaData, record){
				metaData.tdAttr = 'data-qtip="' + value + '"';
				return value;
			}
        }, {
            header: '回复时间',
            dataIndex: 'sendTime',
            width: 120,
			renderer: function(value, metaData, record){
				metaData.tdAttr = 'data-qtip="' + value + '"';
				return value;
			}
        }, {
            header: '回复内容',
            dataIndex: 'replyValue',
            flex: 1,
            minWidth: 120,
			renderer: function(value, metaData, record){
				metaData.style = "white-space:normal;cursor: pointer;color:blue;";
				metaData.tdAttr = "data-qtip='" + value + "' replyId=" + record.get("replyId");
				return value;
			},
            listeners: {
            	click: function(g, clm){
    				var replyId = clm.getAttribute("replyId");
    				var win = Ext.create("PJ.view.messagemanagement.ReplyView", {
            			title: "查看回复内容",
            			grid:me
            		}).show();
    				var actionName = "load";
    				if(gj_onlineLearning_constant.loadType == "jsonp"){
    					actionName = "loadJsonp";
    				}
    				win.down("form").getForm().doAction(actionName,{
    					url:me.store.replyViewUrl,
    					params:{
    						replyId: replyId
    					},
    					success:function(f,action){
    						var data = action.response.responseText;
    	        			var json = gj_onlineLearning_constant.loadType=="ajax" ? Ext.decode(data, true) : action.response;
    	        			var form = win.down('form');	 
    	        			var baseForm = form.getForm();
    					}
    				});

    			}
            }
        }];
        me.store = Ext.create('PJ.'+ prototype +'.messagemanagement.RestoredMessageList', {
            isLoad: false
        });
        this.loadType = gj_onlineLearning_constant.loadType;//加载方式
        me.callParent(arguments);
    },
    listeners: {
    	viewready: function(){
    		var me = this;
            var store = me.store;
            var params = store.proxy.extraParams;
            var newParams = {
            		searchNewsId: me.up('window').newsId,
            		searchNewsUserLink:	me.newsUserLink
            		
            };
            Ext.apply(params, newParams);
            store.isLoad = true;
//            store.load();
    		// 触发权限过滤事件
    		this.fireEvent("permission", this);
    	}
    }
});

